﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using PkwDevFramework.WpfMvvm;

namespace PkwHCFramework.ViewModels
{
    public class MainViewModel : NavViewModel
    {
        public MainViewModel() { }

        public override void Init()
        {
            ViewNamespace = "PkwHCFramework.Pages";
            MenuInit();
            ChangePage("HomePage");
        }

        private void MenuInit()
        {
            ResourceDictionary resources = Application.Current.Resources;
            var lines = File.ReadAllLines("config\\Menu.txt");
            foreach (var item in lines)
            {
                var values = item.Split(',');
                NavigationButtons.Add(
                    new NavigationButton
                    {
                        Content = values[1],
                        IsChecked = true,
                        CommandParameter = values[0] + "Page",
                        IconGeometry = (Geometry)resources[values[0] + "Geometry"]
                    }
                );
            }
        }
    }
}
